package com.my.chapter8;

public class practice16 {
    public static void main(String[] args) {
        AlterStatus a = new AlterStatus();
        a.alert();
        a.alertStatus1();
        a.alert();
        a.alertStatus2();
        a.alert();
    }
}

class Status{
    public void display(){
        System.out.println("Status");
    }
}

class Status1 extends Status{
    public void display(){
        System.out.println("Status1");
    }
}

class Status2 extends Status{
    public void display(){
        System.out.println("Status2");
    }
}

class AlterStatus{
    private Status s = new Status();
    void alert(){
        s.display();
    }
    void alertStatus1(){
        s = new Status1();
    }
    void alertStatus2(){
        s = new Status2();
    }
}
